<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>只响应一次</title>
</head>
<body>
<div id="app">
    <!--只响应一次-->
    <!--实现部分参考 v-once 指令，函数只执行一次-->
    <h1 @click.once="h1Clicked">Hello, Vue</h1>
</div>

<script type="module">
    import {createApp} from "../../../js/vue.esm-browser.js";

    let app = createApp(
        {
            setup() {
                function h1Clicked() {
                    console.log("h1 clicked");
                }

                return {
                    h1Clicked
                }
            }
        }
    );

    app.mount("#app")
</script>
</body>
</html>